import request from '@/utils/request'

export function createTask(taskName, demandId, caseIds) {
  return request({
    url: '/autotest/task/create',
    method: 'post',
    params: { taskName, demandId, caseIds }
  })
}

export function listTask(demandIds, pageNo, pageSize) {
  return request({
    url: '/autotest/task/list',
    method: 'get',
    params: { demandIds, pageNo, pageSize }
  })
}

export function deleteTask(taskId) {
  return request({
    url: '/autotest/task/delete',
    method: 'get',
    params: { taskId }
  })
}

export function autoTest(taskId) {
  return request({
    url: '/autotest/task/autoTest',
    method: 'get',
    params: { taskId }
  })
}

export function taskReportBaseInfo(taskId) {
  return request({
    url: '/autotest/task/taskReport/baseInfo',
    method: 'get',
    params: { taskId }
  })
}

export function taskReportCaseInfo(taskId) {
  return request({
    url: '/autotest/task/taskReport/caseInfo',
    method: 'get',
    params: { taskId }
  })
}

export function taskReportBugsInfo(taskId) {
  return request({
    url: '/autotest/task/taskReport/bugsInfo',
    method: 'get',
    params: { taskId }
  })
}

export function taskReportUserInfo(taskId) {
  return request({
    url: '/autotest/task/taskReport/userInfo',
    method: 'get',
    params: { taskId }
  })
}

export function updateStatus(taskId, status) {
  return request({
    url: '/autotest/task/updateStatus',
    method: 'get',
    params: { taskId, status }
  })
}

export function setCaseExector(data) {
  return request({
    url: '/autotest/task/setCaseExector',
    method: 'post',
    data
  })
}

export function taskRemoveCaseByIds(taskId, caseIds) {
  return request({
    url: '/autotest/task/taskRemoveCaseByIds',
    method: 'get',
    params: { taskId, caseIds }
  })
}
